<%@page import="org.lzy.pt.PluginManager"%>
<%@page import="org.lzy.pt.bean.Plugin"%>
<%@ page import="org.jivesoftware.util.ParamUtils"%>

<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>

<%  // Get parameters //
    boolean cancel = request.getParameter("cancel") != null;
    boolean delete = request.getParameter("delete") != null;
    
    String T_Name = ParamUtils.getParameter(request,"T_Name");
    String T_Ver = ParamUtils.getParameter(request,"T_Ver");

    // Handle a cancel
    if (cancel) {
        response.sendRedirect("plugin-summary.jsp");
        return;
    }

    // Handle a delete
    if (delete) {
        response.sendRedirect("plugin-delete.jsp");
        return;
    }

    Plugin plugin = PluginManager.getInstance().getPlugin(T_Name, Integer.parseInt(T_Ver) );

%>

<html>
    <head>
        <title><fmt:message key="plugin.properties.title"/></title>
        <meta name="subPageID" content="plugin-properties"/>
        <meta name="extraParams" content="<%= "T_Name="+T_Name+"&T_Ver="+T_Ver %>"/>
    </head>
    <body>

<p>
<fmt:message key="plugin.properties.info" />
</p>

<%  if (request.getParameter("success") != null) { %>

    <div class="jive-success">
    <table cellpadding="0" cellspacing="0" border="0">
    <tbody>
        <tr><td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16" border="0" alt=""></td>
        <td class="jive-icon-label">
        <fmt:message key="plugin.properties.created" />
        </td></tr>
    </tbody>
    </table>
    </div><br>
<%  } else if (request.getParameter("editsuccess") != null) { %>

    <div class="jive-success">
    <table cellpadding="0" cellspacing="0" border="0">
    <tbody>
        <tr><td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16" border="0" alt=""></td>
        <td class="jive-icon-label">
        <fmt:message key="plugin.properties.update" />
        </td></tr>
    </tbody>
    </table>
    </div><br>

<% } else if (plugin == null) { %>
    <div class="warning">
    <table cellpadding="0" cellspacing="0" border="0">
    <tbody>
        <tr>
        <td class="jive-icon-label">
            <fmt:message key="error.specific_plugin_not_found">
                <fmt:param value="plugin" />
            </fmt:message>
        </td></tr>
    </tbody>
    </table>
    </div><br>
<%  } %>

<div class="jive-table">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<thead>
    <tr>
        <th colspan="2">
            <fmt:message key="plugin.properties.title" />
        </th>
    </tr>
</thead>
<tbody>
    <% if (plugin == null) { %>
    <tr>
        <td colspan="2" align="center">
            <fmt:message key="error.requested_plugin_not_found" />
        </td>
    </tr>
    <% } else { %>
    <tr>
        <td class="c1"><fmt:message key="plugin.T_Name" />:</td>
        <td><%=plugin.getT_CnName() %></td>
    </tr>
    <tr>
        <td class="c1"><fmt:message key="plugin.T_Ver" />:</td>
        <td><%=plugin.getT_Ver() %></td>
    </tr>
    <tr>
    
        <td class="c1"><fmt:message key="plugin.T_Path" />:</td>
        <td><%=plugin.getT_Path() %></td>
    </tr>
<!--     <tr> -->
<%--         <td class="c1"><fmt:message key="plugin.T_Data" />:</td> --%>
<%--         <td><pre><%=plugin.getT_Data() %></pre></td> --%>
<!--     </tr> -->
    <tr>
        <td class="c1"><fmt:message key="plugin.T_DateTime" />:</td>
        <td><%=plugin.getT_DateTime(true) %></td>
    </tr>
    <% } %>
</tbody>
</table>
</div>

<br><br>

<form action="plugin-summary.jsp">
<input type="submit" value="<fmt:message key="global.cancel" />">
</form>

</body>
</html>